//descriptive statistics for independent and dependent variables

use "reswappublicver080824.dta"


//making sure that aren't extra respondents from OG study
gen yrespm2 = 0
replace yrespm2 = 1 if (m1bs3 ~= . | m1as3 ~= . | m1is3 ~= . | m1ls3 ~= . | ///
	 m1ns3 ~= . | m1ms3 ~= . | m1rs3 ~= . ) & (na == 1| na == 2)
replace yrespm2 = 1 if (m4bs3 ~= . | m4as3 ~= . | m4is3 ~= . | m4ls3 ~= . | ///
	 m4ns3 ~= . | m4ms3 ~= . | m4rs3 ~= . ) & (na == 1| na == 2)
replace yrespm2 = 1 if (m8bs3 ~= . | m8as3 ~= . | m8is3 ~= . | m8ls3 ~= . | ///
	 m8ns3 ~= . | m8ms3 ~= . | m8rs3 ~= . ) & (na == 1| na == 2)


gen yrespw2 = 0
replace yrespw2 = 1 if (w2bs3 ~= . | w2as3 ~= . | w2is3 ~= . | w2ls3 ~= . | ///
	 w2ns3 ~= . | w2ms3 ~= . | w2rs3 ~= . ) & (na == 0| na == 2)
replace yrespw2 = 1 if (w3bs3 ~= . | w3as3 ~= . | w3is3 ~= . | w3ls3 ~= . | ///
	 w3ns3 ~= . | w3ms3 ~= . | w3rs3 ~= . ) & (na == 0| na == 2)
replace yrespw2 = 1 if (w7bs3 ~= . | w7as3 ~= . | w7is3 ~= . | w7ls3 ~= . | ///
	 w7ns3 ~= . | w7ms3 ~= . | w7rs3 ~= . ) & (na == 0| na == 2)
	
tab yrespm2 yrespw2, mi
keep if yrespm2 == 1 | yrespw2 == 1	
	
	
putexcel set "educreswapindvars080824", replace


tab ng, mi
tab ng, mi matcell(cell1)
putexcel B1=("Independent Variables") B4=matrix(cell1) 
putexcel A3=("Gender") A4=("Woman (cis)") A5=("Man (cis)") A6=("Trans/Non-Binary/Other")

tab red, mi
tab red, mi matcell(cell2)
putexcel B8=matrix(cell2)
putexcel A7=("Educational Background") A8=("Less than HS or Completed HS/GED") ///
	A9=("Some College to Associate's") A10=("Bachelor's") A11=("Postgrad degree")

tab nr, mi 
tab nr, mi matcell(cell3)
putexcel B13=matrix(cell3)
putexcel A12=("Religious Affiliation") A13=("Agnostic") A14=("Atheist") ///
	A15=("Protestant") A16=("Catholic") A17=("Christian") A18=("Spiritual") ///
	A19=("Nothing in particular") A20=("Other")

tab year, mi
summarize year
matrix av1=r(mean)
matrix av11=r(sd)
putexcel B21=matrix(av1) B22=matrix(av11)
putexcel A21=("Average Year of Birth with Standard Deviation")

tab na, mi
tab attract na, mi
tab na, mi matcell(cell4)
putexcel B24=matrix(cell4)
putexcel A23=("Who are you sexually attracted to?") A24=("Women") A25=("Men") ///
	A26=("Multiple genders")
	
tab reasonchecked, mi
tab reasontext reasoncheck, mi
list reasontext reasoncheck in 1/20
list reasontext reasoncheck in 20/40
list reasontext reasoncheck if reasoncheck==2 
//0 = unaware, 1 = race, 2 = race and something else 
tab reasonchecked, mi matcell(cell5)
putexcel B28=matrix(cell5)
putexcel A27= ("Awareness of study's goal") A28=("Unaware of goal") ///
	A29=("Stated race as a primary part of goal") A30=("Stated race as 1 of 2+ factors")
	
tab rpeduc, mi
tab rpeduc, mi matcell(cell6)
putexcel B32=matrix(cell6)
putexcel A31=("Parents' Highest Level of Education")  ///
	A32=("Less than HS or Completed HS/GED") ///
	A33=("Some College to Associate's") A34=("Bachelor's") ///
	A35=("Postgrad degree") A36=("Missing")

tab pnati, mi
tab pnati, mi matcell(cell7)
putexcel B38=matrix(cell7)
putexcel A37=("Parents' Nativity") A38=("Both Parents Born in the US") ///
	A39=("At Least One is Foreign-born") A40=("Missing")
	

tab demo, mi
tab rpol demo, mi
tab demo, mi matcell(cell8)
putexcel B42=matrix(cell8)
putexcel A41=("Identifies as a Democrat") A42=("No") A43=("Yes")

tab dateb, mi
tab dateb, mi matcell(cell9)
putexcel B45=matrix(cell9)
putexcel A44=("Has dated someone who is Black") A45=("No") A46=("Yes")

tab netb, mi
tab netb, mi matcell(cell10)
putexcel B48=matrix(cell10)
putexcel A47=("Predominantly Black Social Network") A48=("No") A49=("Yes")

tab blacknlperr, mi //7 missing
summarize blacknlperr
matrix av2=r(mean)
matrix av21=r(sd)
putexcel B50=matrix(av2) B51=matrix(av21) ///
	A50=("Average % of Black People in ZIP Code with Standard Deviation- 7 MISSING")

tab nb, mi
tab nb, mi matcell(cell11)
putexcel B53=matrix(cell11)
putexcel A52=("Wave of Data Collection") A53=("1") A54=("2") A55=("3") ///
	A56=("4") A57=("5")
	
tab nregion, mi
tab nregion, mi nolab
tab nregion, mi matcell(cell12)
putexcel B59=matrix(cell12)
putexcel A58=("Region") A59=("Midwest") A60=("Northeast") A61=("South") ///
	A62=("West") A63=("Missing")
	


putexcel set "reswapEDUCdescripsoutcomes080824", replace


putexcel B1=("Black") C1=("Asian") D1=("Asian Indian") E1=("Latine") ///
	F1=("Native American") G1=("MENA") H1=("Multiracial") 

putexcel A2=("M1") A3=("Mean") A4=("Standard Deviation") A5=("Observations")
summarize m1bs3
matrix av3=r(mean)
matrix av31=r(sd)
matrix av32=r(N)
putexcel B3=matrix(av3) B4=matrix(av31) B5=matrix(av32)

summarize m1as3
matrix av4=r(mean)
matrix av41=r(sd)
matrix av42=r(N) 
putexcel C3=matrix(av4) C4=matrix(av41) C5=matrix(av42)

summarize m1is3
matrix av5=r(mean)
matrix av51=r(sd)
matrix av52=r(N) 
putexcel D3=matrix(av5) D4=matrix(av51) D5=matrix(av52)

summarize m1ls3
matrix av6=r(mean)
matrix av61=r(sd)
matrix av62=r(N) 
putexcel E3=matrix(av6) E4=matrix(av61) E5=matrix(av62)

summarize m1ns3
matrix av7=r(mean)
matrix av71=r(sd)
matrix av72=r(N) 
putexcel F3=matrix(av7) F4=matrix(av71) F5=matrix(av72)

summarize m1ms3
matrix av8=r(mean)
matrix av81=r(sd)
matrix av82=r(N) 
putexcel G3=matrix(av8) G4=matrix(av81) G5=matrix(av82)

summarize m1rs3
matrix av9=r(mean)
matrix av91=r(sd)
matrix av92=r(N) 
putexcel H3=matrix(av9) H4=matrix(av91) H5=matrix(av92)

putexcel A6=("M4") A7=("Mean") A8=("Standard Deviation") A9=("Observations")
summarize m4bs3
matrix av10=r(mean)
matrix av101=r(sd)
matrix av102=r(N) 
putexcel B7=matrix(av10) B8=matrix(av101) B9=matrix(av102)

summarize m4as3
matrix av11=r(mean)
matrix av111=r(sd)
matrix av112=r(N) 
putexcel C7=matrix(av11) C8=matrix(av111) C9=matrix(av112)

summarize m4is3
matrix av12=r(mean)
matrix av121=r(sd)
matrix av122=r(N) 
putexcel D7=matrix(av12) D8=matrix(av121) D9=matrix(av122) 

summarize m4ls3
matrix av13=r(mean)
matrix av131=r(sd)
matrix av132=r(N) 
putexcel E7=matrix(av13) E8=matrix(av131) E9=matrix(av132) 

summarize m4ns3
matrix av14=r(mean)
matrix av141=r(sd)
matrix av142=r(N) 
putexcel F7=matrix(av14) F8=matrix(av141) F9=matrix(av142) 

summarize m4ms3 
matrix av15=r(mean)
matrix av151=r(sd)
matrix av152=r(N) 
putexcel G7=matrix(av15) G8=matrix(av151) G9=matrix(av152) 

summarize m4rs3
matrix av16=r(mean)
matrix av161=r(sd)
matrix av162=r(N) 
putexcel H7=matrix(av16) H8=matrix(av161) H9=matrix(av162) 
 
putexcel A10=("M8") A11=("Mean") A12=("Standard Deviation") A13=("Observations")
summarize m8bs3
matrix av17=r(mean)
matrix av171=r(sd)
matrix av172=r(N) 
putexcel B11=matrix(av17) B12=matrix(av171) B13=matrix(av172) 
 
summarize m8as3
matrix av18=r(mean)
matrix av181=r(sd)
matrix av182=r(N) 
putexcel C11=matrix(av18) C12=matrix(av181) C13=matrix(av182)  

summarize m8is3
matrix av19=r(mean)
matrix av191=r(sd)
matrix av192=r(N) 
putexcel D11=matrix(av19) D12=matrix(av191) D13=matrix(av192) 

summarize m8ls3
matrix av20=r(mean)
matrix av201=r(sd)
matrix av202=r(N) 
putexcel E11=matrix(av20) E12=matrix(av201) E13=matrix(av202) 

summarize m8ns3
matrix av21=r(mean)
matrix av211=r(sd)
matrix av212=r(N) 
putexcel F11=matrix(av21) F12=matrix(av211) F13=matrix(av212) 

summarize m8ms3
matrix av22=r(mean)
matrix av221=r(sd)
matrix av222=r(N) 
putexcel G11=matrix(av22) G12=matrix(av221) G13=matrix(av222)

summarize m8rs3
matrix av23=r(mean)
matrix av231=r(sd)
matrix av232=r(N) 
putexcel H11=matrix(av23) H12=matrix(av231) H13=matrix(av232)

putexcel A14=("W2") A15=("Mean") A16=("Standard Deviation") A17=("Observations")
summarize w2bs3
matrix av24=r(mean)
matrix av241=r(sd)
matrix av242=r(N) 
putexcel B15=matrix(av24) B16=matrix(av241) B17=matrix(av242)

summarize w2as3
matrix av25=r(mean)
matrix av251=r(sd)
matrix av252=r(N) 
putexcel C15=matrix(av25) C16=matrix(av251) C17=matrix(av252)

summarize w2is3
matrix av26=r(mean)
matrix av261=r(sd)
matrix av262=r(N) 
putexcel D15=matrix(av26) D16=matrix(av261) D17=matrix(av262)

summarize w2ls3
matrix av27=r(mean)
matrix av271=r(sd)
matrix av272=r(N) 
putexcel E15=matrix(av27) E16=matrix(av271) E17=matrix(av272)

summarize w2ns3
matrix av28=r(mean)
matrix av281=r(sd)
matrix av282=r(N) 
putexcel F15=matrix(av28) F16=matrix(av281) F17=matrix(av282)

summarize w2ms3
matrix av29=r(mean)
matrix av291=r(sd)
matrix av292=r(N) 
putexcel G15=matrix(av29) G16=matrix(av291) G17=matrix(av292)

summarize w2rs3
matrix av30=r(mean)
matrix av301=r(sd)
matrix av302=r(N) 
putexcel H15=matrix(av30) H16=matrix(av301) H17=matrix(av302)

putexcel A18=("W3") A19=("Mean") A20=("Standard Deviation") A21=("Observations")
summarize w3bs3
matrix av31=r(mean)
matrix av311=r(sd)
matrix av312=r(N) 
putexcel B19=matrix(av31) B20=matrix(av311) B21=matrix(av312)

summarize w3as3
matrix av32=r(mean)
matrix av321=r(sd)
matrix av322=r(N) 
putexcel C19=matrix(av32) C20=matrix(av321) C21=matrix(av322)

summarize w3is3
matrix av33=r(mean)
matrix av331=r(sd)
matrix av332=r(N) 
putexcel D19=matrix(av33) D20=matrix(av331) D21=matrix(av332)

summarize w3ls3
matrix av34=r(mean)
matrix av341=r(sd)
matrix av342=r(N) 
putexcel E19=matrix(av34) E20=matrix(av341) E21=matrix(av342)

summarize w3ns3
matrix av35=r(mean)
matrix av351=r(sd)
matrix av352=r(N) 
putexcel F19=matrix(av35) F20=matrix(av351) F21=matrix(av352)

summarize w3ms3
matrix av36=r(mean)
matrix av361=r(sd)
matrix av362=r(N) 
putexcel G19=matrix(av36) G20=matrix(av361) G21=matrix(av362)

summarize w3rs3
matrix av37=r(mean)
matrix av371=r(sd)
matrix av372=r(N) 
putexcel H19=matrix(av37) H20=matrix(av371) H21=matrix(av372)

putexcel A22=("W7") A23=("Mean") A24=("Standard Deviation") A25=("Observations")
summarize w7bs3
matrix av38=r(mean)
matrix av381=r(sd)
matrix av382=r(N) 
putexcel B23=matrix(av38) B24=matrix(av381) B25=matrix(av382)

summarize w7as3
matrix av39=r(mean)
matrix av391=r(sd)
matrix av392=r(N) 
putexcel C23=matrix(av39) C24=matrix(av391) C25=matrix(av392)

summarize w7is3
matrix av40=r(mean)
matrix av401=r(sd)
matrix av402=r(N) 
putexcel D23=matrix(av40) D24=matrix(av401) D25=matrix(av402)

summarize w7ls3
matrix av41=r(mean)
matrix av411=r(sd)
matrix av412=r(N)
putexcel E23=matrix(av41) E24=matrix(av411) E25=matrix(av412)

summarize w7ns3
matrix av42=r(mean)
matrix av421=r(sd)
matrix av422=r(N)
putexcel F23=matrix(av42) F24=matrix(av421) F25=matrix(av422)

summarize w7ms3
matrix av43=r(mean)
matrix av431=r(sd)
matrix av432=r(N)
putexcel G23=matrix(av43) G24=matrix(av431) G25=matrix(av432)

summarize w7rs3
matrix av44=r(mean)
matrix av441=r(sd)
matrix av442=r(N)
putexcel H23=matrix(av44) H24=matrix(av441) H25=matrix(av442)

clear
